package com.vimi8.ebb.auth.utils;

import org.springframework.util.StringUtils;

import java.util.Arrays;
import java.util.LinkedHashSet;

/**
 * Created by wangguiyin on 2016/9/8.
 * 分页工具类
 */
public class PagesUtil {

    private int currentPage;//当前页码
    private int pageSize;//页面大小
    private int totalCount;//总记录数
    private int totalPage;//总页数
    private int startPage;//开始页

    public int getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        if(pageSize>0){

            this.pageSize = pageSize;
        }
    }

    public int getStartPage() {

        return (this.currentPage-1)*this.pageSize;
    }

    public void setStartPage(int startPage) {
        this.startPage = startPage;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
        if(totalCount>0)
            this.totalPage=this.totalCount%this.pageSize==0?this.totalCount/this.pageSize:this.totalCount/this.pageSize+1;
    }

    public int getTotalPage() {
        return totalPage;
    }

    public void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }

}
